<?php
$this->Html->script(array('plugins/datatables/jquery.dataTables.min'), false);
?>
<div class="row-fluid">
	<div class="span12">
		<div class="block">
			<?php
			$continue = array(
				'?' => array('continue' => $this->request->here(false))
			);
			echo $this->Session->flash();
			?>
			<div class="data-fluid">
				<table class="table paginate lcnp" cellpadding="0" cellspacing="0" width="100%">
					<thead>
						<tr>
							<th width="20%"><?php echo __('Name'); ?></th>
							<?php if (!empty($displayLink)) : ?>
								<th><?php echo __('Liên kết'); ?></th>
							<?php endif; ?>
							<th width="30%"><?php echo __('Mô tả'); ?></th>
							<th width="100"><?php echo __('Ngày tạo'); ?></th>
							<th width="120"><?php echo __('Từ khóa'); ?></th>
							<th width="50" class="TAC">Actions</th>
						</tr>
					</thead>
					<tbody>
						<?php foreach ($keywordTasks as $task) : ?>
							<tr>
								<td>
									<?php
									echo $this->Html->link($task['Task']['name'], $continue + array(
										'controller' => 'keywords', 'action' => 'task_edit', $task['Task']['id']));
									?>
								</td>
								<?php if (!empty($displayLink)) : ?>
									<td>
										<?php echo $this->Html->link($task['Task']['link'] , array(
											'controller' => 'keywords', 'action' => 'task_index', '?' => array('url' => $task['Task']['link'])
										)); ?>
									</td>
								<?php endif; ?>
								<td>
									<?php echo $task['Task']['description']; ?>
								</td>
								<td>
									<?php echo date('d/m/Y H:i', $task['Task']['created']); ?>
								</td>
								<td>
									<?php
									if ($task['Keyword']['id'] !== @$keyword['Keyword']['id']) {
										echo $this->Html->link($task['Keyword']['name'], array(
											'action' => 'report', $task['Keyword']['id']
										));
									} else {
										echo $this->Html->link($task['Keyword']['name'], '#');
									}
									?>
								</td>
								<td class="table-action">
									<a href="<?php echo $this->Html->url($continue + array('controller' => 'keywords', 'action' => 'task_edit', $task['Task']['id'])); ?>" class="btn btn-mini green">
										<div class="icon"><span class="ico-pencil"></span></div>
									</a>
									<a href="<?php echo $this->Html->url($continue + array('controller' => 'keywords', 'action' => 'task_delete', $task['Task']['id'])); ?>" class="btn btn-mini red">
										<div class="icon"><span class="ico-remove"></span></div>
									</a>                                              
								</td>
							</tr>
						<?php endforeach; ?>                         
					</tbody>
				</table>                    
			</div> 
		</div>
	</div>
</div>